<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>hello</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" th:href="@{/css/jquery.mobile-1.4.5.min.css }"/>
    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/jquery.mobile-1.4.5.min.js}"></script>
    <link rel="stylesheet" th:href="@{/css/iconfont.css}"/>
    <style>
    .lv1 .ui-grid-a .ui-block-a{
    width: 25%;
    }
    .lv1.ui-grid-solo {
    margin-top: -20px;
    }
    </style>
    <style>
     .ui-icon-guiji:after{
         background:url('/image/guiji.png') no-repeat 0px 0px;
      }
    .ui-icon-partners:after{
        background:url(/image/paetners.png) no-repeat 0px 0px;
    }
    .ui-icon-my:after{
        background:url(/image/my.png) no-repeat 0px 0px;
    }
    .ui-icon-zhanghao:after{
        background:url(/image/zhanghao.png) no-repeat 0px 0px;
    }
    .ui-icon-about:after{
        background:url(/image/about.png) no-repeat 0px 0px;
    }
    </style>
    <script type="text/javascript">
        $(document).ready(function() {
                window.sessionStorage.removeItem("base64");
                window.sessionStorage.removeItem("eid");
                window.sessionStorage.removeItem("praiseflag");
                window.sessionStorage.removeItem("euserid");
                $("div").bind("swiperight", function (event) {
                    //$("#userpanel").panel("open");
                    var user = sessionStorage.getItem("userid");
                    console.log(user);
                    if (user != null) {
                        window.location = "/ViewController/goUserPanel2";
                    } else {
                        window.location = "/ViewController/goUserPanel";
                    }
                });
            });
        </script>
    <script>
        function UserPage(){
            var user=JSON.parse(sessionStorage.getItem("user"));
            console.log(user);
            if(user!=null){
                window.location = "/ViewController/goUserPanel2";

            }else{
                window.location = "/ViewController/goUserPanel";
            }
        }
        function saveEid(eid){
            sessionStorage.setItem("eid",eid);
            console.log(eid);
            window.location = "/ViewController/toDetailed";
        }
        function closePup(){
            $("#pleaseLogin").popup('close');
        }
        function toLogin(){
            window.location = "/ViewController/toLogin";
        }
        function goMy(){
            var user=JSON.parse(sessionStorage.getItem("user"));
            if(user==null||user==""){
                $("#pleaseLogin").popup('open');
            }else{
                window.location = "/ViewController/toMy";
            }
        }
        function goZhanshi(){
            var user=JSON.parse(sessionStorage.getItem("user"));
            var userid="";
            if(user==null||user==""){
                $("#pleaseLogin").popup('open');
            }else{
                userid=user.userid;
                window.location = "/UserController/getPartnersNoMe?userid="+userid;
            }
        }
    </script>
</head>
<body>
<div>
    <div data-role = "page">
        <div data-role = "header"  data-fullscreen = "true">
            <a  onclick ="UserPage()" data-icon = "zhanghao" data-ajax = "false" id="userpage">账号</a>
            <h1>我的伙伴</h1>
            <a href="/ViewController/goAbout" data-icon = "about" data-ajax = "false">关于</a>
        </div>
        <div data-role = "content">
            <ul data-role = "listview" class="lv1" id="lv1">
                <div th:each="Exs,stat:${ListEx}">
                    <a style='color: #000000; text-decoration:none;' data-ajax='false' th:onclick="'javascript: saveEid('+${Exs.eid}+')' ">
                        <li style='margin-bottom:20px;background-color:#ffffff;'> <div class='ui-grid-a'>
                            <div class='ui-block-a'>
                                <div class='ui-bar ui-bar-c' >
                                    <img th:src='${Exs.userhead}' width='100%' style='border-radius:100%;'/>
                            </div>
                        </div>
                            <div class='ui-block-b'>
                                <div class='ui-bar ui-bar-c'>
                                    <h1 th:text="${Exs.name}"></h1>
                                    <p th:text="${Exs.createtime}">></p>
                                </div>
                            </div>
                        </div>
                        <div class='ui-grid-solo'>
                            <div class='ui-block-a'>
                                <div class='ui-bar ui-bar-c'>
                                    <p th:text="${Exs.eTitle}">标题</p>
                                </div>
                            </div>
                        </div>
                        <div class='ui-grid-solo'>
                            <div class='ui-block-a'>
                                <div class='ui-bar ui-bar-c'>
                                    <img th:src='${Exs.eImage}' style='width:150px;'/>
                                </div>
                            </div>
                        </div>
                            <div class='ui-grid-c'>
                                <div class='ui-block-a'>
                                    <div class='ui-bar ui-bar-c'>
                                        <span class='iconfont icon-pinglun' th:text="${Exs.comment_points}"/>
                                    </div>
                                </div>
                                <div class='ui-block-b'></div>
                                <div class='ui-block-c'>
                                    <div class='ui-bar ui-bar-c'>

                                    </div>
                                </div>
                                <div class='ui-block-d'>
                                    <div class='ui-bar ui-bar-c'>
                                        <span id='praise' class='iconfont icon-dianzan' th:text="${Exs.praise_points}"/>
                                    </div>
                                </div>
                            </div>
                            </li>
                    </a>
                </div>

            </ul>
        </div>

        <div data-role = "popup" id="pleaseLogin" data-position-to = "window" data-dismissible = "false">
            <div style="padding: 10px;">
                <h3>您尚未登录，请先登录</h3>
                <div class="ui-grid-a">
                    <div class="ui-block-a">
                        <a data-role = "button" onclick="toLogin()">登录</a>
                    </div>
                    <div class="ui-block-b">
                        <a data-role = "button" onclick="closePup()">取消</a>
                    </div>
                </div>
            </div>
        </div>

        <div data-role = "footer" data-position = "fixed" data-tap-toggle="false">
            <div data-role = "navbar" data-grid = "b">
                <ul>
                    <li>
                        <a href="#" data-icon = "guiji" class="ui-btn-active ui-state-persist" data-ajax = "false">成长轨迹</a></li>
                    <li><a onclick="goZhanshi()" data-icon = "partners" data-ajax = "false">伙伴</a></li>
                    <li><a onclick="goMy()" data-icon = "my" data-ajax = "false">我的</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>